-
Notifications
You must be signed in to change notification settings - Fork 16.3k
Preserve existing metadata labels (and other fields) in SparkApplication manifest #56063
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission.
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
|
All GHA checks were successful, except for [CI image checks / Static checks], which failed due missing licence text in other files not related to the PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Just add test
|
tests for the custom_object_launcher already exist and covers the updated part. |
Your PR changes/fix behavior thus you can't claim tests already cover the fix. |
test suite for get_body logic in CustomObjectLauncher, including metadata handling
|
Tests added:
Waiting for GHA to finish all workflows, otherwise it should be good (fingers Crossed). |
|
Now it's ready. It looks great! |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
…plication manifest (apache#56063) * Preserve existing metadata labels in SparkApplication manifest Ensure that CustomObjectLauncher updates only the 'name' and 'namespace' fields in the metadata without overwriting existing labels or annotations. This change uses dict.update() to safely modify the metadata in place, preventing loss of important SparkApplication metadata during submission. * misc: format committed lines for consistency * Fix: Safely handle missing `metadata` attribute in SparkJobSpec * Add unit tests for get_body method in CustomObjectLauncher test suite for get_body logic in CustomObjectLauncher, including metadata handling
This PR addresses an issue in the CustomObjectLauncher operator within the Kubernetes provider, where submitting a SparkApplication manifest -using the SparkKubernetesOperator- results in the loss of existing metadata labels and annotations.
The current implementation in get_body() overwrites the entire metadata object:
self.body.metadata = {"name": self.name, "namespace": self.namespace}This discards any pre-existing metadata such as labels, annotations, or custom fields.
This PR replaces the overwrite with an in-place update using dict.update().
Testing:
This fix has been validated with the following setup:
SparkApplication resources submitted via the SparkKubernetesOperator now retain their original metadata labels as expected.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.